package com.six.JacksonOperation;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.six.entity.Cat;
import com.six.entity.Order;

import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * ClassName:JsonToJava
 * Package:com.six
 * Description
 *
 * @Author:@wenxueshi
 * @Create:2023/7/27 - 22:48
 * @Version:v1.0
 */
// @JsonIgnore
public class JsonToJava10 {

    public static void main(String[] args) throws IOException {
        ObjectMapper objectMapper = new ObjectMapper();
        Cat tom = new Cat("tom", 18);
        String json = objectMapper.writeValueAsString(tom);
        //因为对象属性age设置了被忽略：{"name":"tom"}
        System.out.println(json);
    }
}
